package com.guqin.interview.controller;

import com.guqin.interview.common.BaseResponse;
import com.guqin.interview.common.ResultUtils;
import com.guqin.interview.model.entity.Question;
import com.guqin.interview.model.vo.QuestionVO;
import com.guqin.interview.service.QuestionRecommendService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 题目推荐接口
 */
@RestController
@RequestMapping("/question/recommend")
public class QuestionRecommendController {

    @Resource
    private QuestionRecommendService questionRecommendService;

    /**
     * 获取推荐题目
     *
     * @param userId 用户ID
     * @param limit 推荐数量
     * @return 推荐的题目列表
     */
    @GetMapping("/list")
    public BaseResponse<List<QuestionVO>> getRecommendQuestions(
            @RequestParam Long userId,
            @RequestParam(defaultValue = "10") int limit) {
        List<QuestionVO> questions = questionRecommendService.recommendQuestionsByUserTags(userId, limit);
        return ResultUtils.success(questions);
    }
} 